const app = getApp();
const api = require('../../utils/api');
const Env = require('../../config/env');

Page({
    data: {
        navBarHeight: 0,
        
        qrcodeUrl: '', //分享二维码
        invitationCode: '', //邀请码
    },
    onLoad(options) {
        const systemInfo = wx.getWindowInfo();
		this.setData({
            navBarHeight: systemInfo.statusBarHeight,
        });

        this.getQRCode();
    },
    onShow() {
        this.setData({
            invitationCode: app.globalData.userInfo.invitationCode
        })
    },
    getQRCode() {
        api.post(`/user/share/miniqrcode?wxAppId=${Env.appId}`)
            .then(res => {
                this.setData({
                    qrcodeUrl: res
                });
            })
    },

    goBack() { //返回
        wx.navigateBack(-1);
    },
})